package com.atguigu.mq.simple;

import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;

@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration("classpath:spring-rabbitmq.xml")
public class Producer {
      @Autowired
    RabbitTemplate rabbitTemplate;
      @Test
    public void t1(){
          String message="hello spring rabbitMQ ";
          rabbitTemplate.convertAndSend("","spring_simple_queue",message);

      }

    @Test
    public void t2(){
        String message="hello spring rabbitMQ funout ";
        rabbitTemplate.convertAndSend("spring_funout_ex","",message);

    }

    @Test
    public void t3(){
        String message="hello spring rabbitMQ topic ";
        rabbitTemplate.convertAndSend("spring_topic_ex","topic.hello.a",message);

    }
}
